*/
class ParserTest {
/**
- * boolean $color whereas output should be colorized
+ * @var bool $color whereas output should be colorized
*/
private $color;
/**
- * boolean $showOutput Show test output
+ * @var bool $showOutput Show test output
*/
private $showOutput;
/**
- * boolean $useTemporaryTables Use temporary tables for the temporary database
+ * @var bool $useTemporaryTables Use temporary tables for the temporary database
*/
private $useTemporaryTables = true;
/**
- * boolean $databaseSetupDone True if the database has been set up
+ * @var bool $databaseSetupDone True if the database has been set up
*/
private $databaseSetupDone = false;
private $dbClone;
/**
- * string $oldTablePrefix Original table prefix
+ * @var string $oldTablePrefix Original table prefix
*/
private $oldTablePrefix;
* CSSJanus libary:
* http://code.google.com/p/cssjanus/source/browse/trunk/cssjanus_test.py
* Ported to PHP for ResourceLoader and has been extended since.
+ *
+ * @covers CSSJanus
*/
class CSSJanusTest extends MediaWikiTestCase {
/**
* @dataProvider provideTransformCases
*/
- function testTransform( $cssA, $cssB = null ) {
+ public function testTransform( $cssA, $cssB = null ) {
if ( $cssB ) {
$transformedA = CSSJanus::transform( $cssA );
/**
* @dataProvider provideTransformAdvancedCases
*/
- function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
+ public function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
$swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? $options['swapLtrRtlInURL'] : false;
$swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? $options['swapLeftRightInURL'] : false;
* @dataProvider provideTransformBrokenCases
* @group Broken
*/
- function testTransformBroken( $code, $expectedOutput ) {
+ public function testTransformBroken( $code, $expectedOutput ) {
$flipped = CSSJanus::transform( $code );
$this->assertEquals( $expectedOutput, $flipped, 'Test flipping' );
* @group Database
* @group Parser
* @group Stub
+ *
+ * @todo covers tags
*/
class NewParserTest extends MediaWikiTestCase {
static protected $articles = array(); // Array of test articles defined by the tests
/**
* @dataProvider providePreSaveTransform
+ * @covers Parser::preSaveTransform
*/
public function testPreSaveTransform( $text, $expected ) {
global $wgParser;
$this->assertEquals( $expected, $text );
}
+ /**
+ * @covers Parser::callParserFunction
+ */
public function testCallParserFunction() {
global $wgParser;
), $ret, 'callParserFunction works for {{#tag:pre|foo|style=margin-left: 1.6em}}' );
}
+ /**
+ * @covers Parser::parse
+ * @covers ParserOutput::getSections
+ */
public function testGetSections() {
global $wgParser;
),
), $out->getSections(), 'getSections() with proper value when <h2> is used' );
}
- // TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
+ //@Todo Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
}
class ParserOutputTest extends MediaWikiTestCase {
- function dataIsLinkInternal() {
+ public static function provideIsLinkInternal() {
return array(
// Different domains
array( false, 'http://example.org', 'http://mediawiki.org' ),
/**
* Test to make sure ParserOutput::isLinkInternal behaves properly
- * @dataProvider dataIsLinkInternal
+ * @dataProvider provideIsLinkInternal
+ * @covers ParserOutput::isLinkInternal
*/
- function testIsLinkInternal( $shouldMatch, $server, $url ) {
-
+ public function testIsLinkInternal( $shouldMatch, $server, $url ) {
$this->assertEquals( $shouldMatch, ParserOutput::isLinkInternal( $server, $url ) );
}
+ /**
+ * @covers ParserOutput::setExtensionData
+ * @covers ParserOutput::getExtensionData
+ */
public function testExtensionData() {
$po = new ParserOutput();
* @author Antoine Musso
*/
class ParserPreloadTest extends MediaWikiTestCase {
+ /**
+ * @var Parser
+ */
private $testParser;
+ /**
+ * @var ParserOptions
+ */
private $testParserOptions;
+ /**
+ * @var Title
+ */
private $title;
protected function setUp() {
/**
* @covers Parser::getPreloadText
*/
- function testPreloadSimpleText() {
+ public function testPreloadSimpleText() {
$this->assertPreloaded( 'simple', 'simple' );
}
/**
* @covers Parser::getPreloadText
*/
- function testPreloadedPreIsUnstripped() {
+ public function testPreloadedPreIsUnstripped() {
$this->assertPreloaded(
'<pre>monospaced</pre>',
'<pre>monospaced</pre>',
/**
* @covers Parser::getPreloadText
*/
- function testPreloadedNowikiIsUnstripped() {
+ public function testPreloadedNowikiIsUnstripped() {
$this->assertPreloaded(
'<nowiki>[[Dummy title]]</nowiki>',
'<nowiki>[[Dummy title]]</nowiki>',
);
}
- function assertPreloaded( $expected, $text, $msg = '' ) {
+ protected function assertPreloaded( $expected, $text, $msg = '' ) {
$this->assertEquals(
$expected,
$this->testParser->getPreloadText(
<?php
class PreprocessorTest extends MediaWikiTestCase {
- var $mTitle = 'Page title';
- var $mPPNodeCount = 0;
- var $mOptions;
+ protected $mTitle = 'Page title';
+ protected $mPPNodeCount = 0;
+ /**
+ * @var ParserOptions
+ */
+ protected $mOptions;
+ /**
+ * @var Preprocessor
+ */
+ protected $mPreprocessor;
protected function setUp() {
global $wgParserConf, $wgContLang;
* @param string $wikiText
* @return string
*/
- function preprocessToXml( $wikiText ) {
+ protected function preprocessToXml( $wikiText ) {
if ( method_exists( $this->mPreprocessor, 'preprocessToXml' ) ) {
return $this->normalizeXml( $this->mPreprocessor->preprocessToXml( $wikiText ) );
}
* @param string $xml
* @return string
*/
- function normalizeXml( $xml ) {
+ protected function normalizeXml( $xml ) {
return preg_replace( '!<([a-z]+)/>!', '<$1></$1>', str_replace( ' />', '/>', $xml ) );
}
/**
* @dataProvider provideCases
+ * @covers Preprocessor_DOM::preprocessToXml
*/
- function testPreprocessorOutput( $wikiText, $expectedXml ) {
+ public function testPreprocessorOutput( $wikiText, $expectedXml ) {
$this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) );
}
/**
* @dataProvider provideFiles
+ * @covers Preprocessor_DOM::preprocessToXml
*/
- function testPreprocessorOutputFiles( $filename ) {
+ public function testPreprocessorOutputFiles( $filename ) {
$folder = __DIR__ . "/../../../parser/preprocess";
$wikiText = file_get_contents( "$folder/$filename.txt" );
$output = $this->preprocessToXml( $wikiText );
/**
* @dataProvider provideHeadings
+ * @covers Preprocessor_DOM::preprocessToXml
*/
function testHeadings( $wikiText, $expectedXml ) {
$this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) );